//
//  ViewController.swift
//  Core Animation移动图片
//
//  Created by quanhao huang on 2019/9/27.
//  Copyright © 2019 demo. All rights reserved.
//

import UIKit

class ViewController: UIViewController {

    @IBOutlet weak var ball: UIView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
    }

    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(true)
        UIView.animate(withDuration: 2.0) {
            self.ball.center = CGPoint(x: 20, y: 20)
            //如果使用了autolayout则添加以下代码
            self.view.layoutIfNeeded()
        }
    }

}

